package com.xf.oschina.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.xf.oschina.module.book.domain.Book;
import com.xf.oschina.module.book.domain.Categories;
import com.xf.oschina.module.book.domain.NewsList;
import com.xf.oschina.module.story.domain.BooksBean;

import com.xf.oschina.dao.BookDao;
import com.xf.oschina.dao.CategoriesDao;
import com.xf.oschina.dao.NewsListDao;
import com.xf.oschina.dao.BooksBeanDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig bookDaoConfig;
    private final DaoConfig categoriesDaoConfig;
    private final DaoConfig newsListDaoConfig;
    private final DaoConfig booksBeanDaoConfig;

    private final BookDao bookDao;
    private final CategoriesDao categoriesDao;
    private final NewsListDao newsListDao;
    private final BooksBeanDao booksBeanDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        bookDaoConfig = daoConfigMap.get(BookDao.class).clone();
        bookDaoConfig.initIdentityScope(type);

        categoriesDaoConfig = daoConfigMap.get(CategoriesDao.class).clone();
        categoriesDaoConfig.initIdentityScope(type);

        newsListDaoConfig = daoConfigMap.get(NewsListDao.class).clone();
        newsListDaoConfig.initIdentityScope(type);

        booksBeanDaoConfig = daoConfigMap.get(BooksBeanDao.class).clone();
        booksBeanDaoConfig.initIdentityScope(type);

        bookDao = new BookDao(bookDaoConfig, this);
        categoriesDao = new CategoriesDao(categoriesDaoConfig, this);
        newsListDao = new NewsListDao(newsListDaoConfig, this);
        booksBeanDao = new BooksBeanDao(booksBeanDaoConfig, this);

        registerDao(Book.class, bookDao);
        registerDao(Categories.class, categoriesDao);
        registerDao(NewsList.class, newsListDao);
        registerDao(BooksBean.class, booksBeanDao);
    }
    
    public void clear() {
        bookDaoConfig.clearIdentityScope();
        categoriesDaoConfig.clearIdentityScope();
        newsListDaoConfig.clearIdentityScope();
        booksBeanDaoConfig.clearIdentityScope();
    }

    public BookDao getBookDao() {
        return bookDao;
    }

    public CategoriesDao getCategoriesDao() {
        return categoriesDao;
    }

    public NewsListDao getNewsListDao() {
        return newsListDao;
    }

    public BooksBeanDao getBooksBeanDao() {
        return booksBeanDao;
    }

}
